/**

 */
package com.adkfp.action;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.adkfp.bean.ADKActimeBean;
import com.adkfp.bean.ADKControllerBean;
import com.adkfp.service.IADKActimeService;
import com.adkfp.utils.LayuiUtil;

/**
 * class name:SelectclassAction <BR>
 * class description: please write your description <BR>
 * Remark: <BR>
 * @version 1.00 2019年2月20日
 * @author ADK)zhoulin
 */
@Controller
@RequestMapping("aDKActime")
public class ADKActimeAction {
	@Resource(name="aDKActimeService")
	private IADKActimeService aDKActimeService;
	
	/**
 	* Method name: selectAll <BR>
 	* Description: 查询所有记录 <BR>
 	* Remark: <BR>
 	* @param bean
 	* @return  Object<BR>
 	*/
	@RequestMapping("selectAll")
	@ResponseBody
	public Object selectAll(ADKActimeBean bean,String ctrlAddr) {
		//System.out.println("----------------------------aaa"+ctrlAddr);
		bean.setCtrlAddr(Integer.parseInt(ctrlAddr));
		List<ADKActimeBean> list = new ArrayList<>();
		list = aDKActimeService.findByCondition(bean);
		long count = aDKActimeService.findByConditionCount(bean);
		return LayuiUtil.data(count, list);
	}
	
	/**
 	* Method name: delete <BR>
 	* Description: 删除记录 <BR>
 	* Remark: <BR>
 	* @param bean
 	* @return  Object<BR>
 	*/
	@RequestMapping("delete")
	@ResponseBody
	public void delete(String autoID) {
		//System.out.println("----------迪士尼----------"+autoID);
		aDKActimeService.delete(Integer.parseInt(autoID));
	}
	
	/**
	 * Method name: index <BR>
	 * Description: 转发到页面 <BR>
	 * Remark: <BR>
	 * @return  String<BR>
	 */
	@RequestMapping("index")
	public String index() {
		return "aDKActime/actimelist";
	}
	
	/**
	 * Method name: insert <BR>
	 * Description: 增加 <BR>
	 * Remark: <BR>
	 * @return  String<BR>
	 */
	@RequestMapping("insert")
	@ResponseBody
	public void insert(HttpServletRequest request,ADKActimeBean bean,String ctrlAddr) {
		System.err.println("----------"+ctrlAddr);
		if(bean.getAutoID()!=null&&bean.getAutoID()!=0) {
			aDKActimeService.update(bean);
		}else {
			aDKActimeService.insert(bean);
		}
	}
	
	
	
	//增加控制器
		@RequestMapping("actimeadd")
		@ResponseBody
		public void actimeadd(ADKActimeBean bean,String ctrlAddr) {
			aDKActimeService.insert(bean);
		}
	
	//用于修改页面(查找id)
			@RequestMapping("findId")
			public String findId(HttpServletRequest request,String autoID,ADKActimeBean bean,String ctrlAddr) {
				if(autoID != null && !autoID.equals("")) {
					bean=aDKActimeService.findById(Integer.parseInt(autoID));
				}
				System.err.println("zhoulin---------------"+ctrlAddr);
				//bean.setCtrlAddr(Integer.parseInt(ctrlAddr));
				request.setAttribute("u",bean);
				return "aDKActime/actimeadd";
			}
			
			
			
}
